/**
 * 2012-7-8
 * jqsl2012@163.com
 */
package net.jeeshop.services.manage.indexnews.dao.impl;

import net.jeeshop.core.dao.BaseDao;
import net.jeeshop.core.dao.page.PagerModel;
import net.jeeshop.services.manage.indexnews.bean.IndexNews;
import net.jeeshop.services.manage.indexnews.dao.IndexNewsDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author huangf
 */
@Repository("indexnewsDaoManage")
public class IndexNewsDaoImpl implements IndexNewsDao {
    @Resource
	private BaseDao dao;

	public void setDao(BaseDao dao) {
		this.dao = dao;
	}

	public PagerModel selectPageList(IndexNews e) {
		return dao.selectPageList("manage.indexnews.selectPageList",
				"manage.indexnews.selectPageCount", e);
	}

	public List selectList(IndexNews e) {
		return dao.selectList("manage.indexnews.selectList", e);
	}

	public IndexNews selectOne(IndexNews e) {
		return (IndexNews) dao.selectOne("manage.indexnews.selectOne", e);
	}

	public int delete(IndexNews e) {
		return dao.delete("manage.indexnews.delete", e);
	}

	public int update(IndexNews e) {
		return  dao.update("manage.indexnews.update", e);
	}

	/**
	 * 批量删除用户
	 * 
	 * @param ids
	 */
	public int deletes(String[] ids) {
		IndexNews e = new IndexNews();
		for (int i = 0; i < ids.length; i++) {
			e.setId(ids[i]);
			delete(e);
		}
		return 0;
	}

	public int insert(IndexNews e) {
		return dao.insert("manage.indexnews.insert", e);
	}

	/**
	 * @param bInfo
	 */
	public List<IndexNews> getLoseList(IndexNews bInfo) {
		return dao.selectList("manage.indexnews.getLoseList", bInfo);
	}

	@Override
	public List<IndexNews> selecIndexNews(IndexNews e) {
		return dao.selectList("manage.indexnews.selecIndexNews", e);
	}

	@Override
	public int deleteById(int id) {
		return dao.delete("manage.indexnews.deleteById",id);
	}

	@Override
	public void sync(IndexNews news) {
		dao.update("manage.indexnews.sync",news);
	}

	public IndexNews selectById(String id) {
		return (IndexNews) dao.selectOne("manage.indexnews.selectById",id);
	}

	@Override
	public void updateDownOrUp(IndexNews news) {
		dao.update("manage.indexnews.updateDownOrUp",news);
	}

	@Override
	public int selectCount(IndexNews news) {
		return (Integer) dao.selectOne("manage.indexnews.selectCount",news);
	}
}
